/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkgjeudestrategie;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JComponent;

/**
 *
 * @author Admin
 */
public class TimeButton extends JComponent {

    int playerTurn = 0;
    int nbPlayers;
    boolean newPlayer = false;
    boolean newRealTurn=false;
    ImageIcon img;
    public TimeButton(int nb) {
        this.nbPlayers = nb;
        addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                playerTurn++;
                newPlayer = true;
                
                if (nbPlayers <= playerTurn) {
                    playerTurn = 0;
                    newRealTurn=true;
                }
                

            }
        });
    }
    public void setNewRealTurn(boolean b){
        newRealTurn=false;
    }
    public boolean getNewRealTurn(){
        return newRealTurn;
    }
    public boolean getNewPlayer() {
        return newPlayer;
    }

    public void setNewPlayerFalse() {
        newPlayer = false;
    }

    public int getPlayerTurn() {
        return playerTurn;
    }

    public void paintComponent(Graphics g) {
        g.setColor(Color.lightGray);
        g.fillRect(0,0,200,200);
        img = new ImageIcon("imagespi/imgBtnTour.png");
        img.paintIcon(this, g, 10, 0);


        /*g.setColor(Color.black);
        g.fillOval(10, 0, 49, 49);
        g.setColor(Color.red);
        g.fillOval(13, 3, 43, 43);*/
    }
}
